<?php
	include "../php/HeaderBlock.php";
	$header = &New HeaderBlock;
	$header->highlighted="events";
	$header->extra_stylesheets="calendar.css";
	$header->javascripts="calendar.js,bookform_validation.js";
	$header->onload_js="cal_init();bookform_validation_init();";
	$header->print_head();
?>
<div class="content">

<h2>Book An Event</h2>

To book use of the space, fill in the form below, or just
pop round and see us!<br />
As well as booking a slot, you also need to make sure a keyholder is available to open the room. See the <a href="http://theoarc.org.uk/oarcwiki/KeyholderList">KeyholderList</a> for contact details.<br />

<br /><br />

<form id="create_form" name="create_form" method="post" action="_book.php">
<table align="center">

   <tr>
     <td class="RightSide">Event</td>
     <td class="LeftSide"><input id="title" name="title" type="text" size="75" /></td>
   </tr>

   <tr>
     <td class="RightSide">Date</td>
     <td class="LeftSide">
       <select name="date_day" id="date_day">
<?php
                for ($i=1;$i<32;$i++) {
                   $i_str = sprintf("%02d",$i);
                   echo "             <option";
                   if ($i_str == date("d")) echo " selected";
                   echo ">" . $i_str . "</option>\n";
                }
?>
       </select>

       <select name="date_month" id="date_month">
<?php
                for ($i=1;$i<13;$i++) {
                   $i_str = sprintf("%02d",$i);
                   echo "             <option value=\"" . $i_str . "\"";
                   if ($i_str == date("m")) echo " selected";
                   echo ">" . date("F", strtotime("2000-". $i_str ."-01")) . "</option>\n";
                }
?>
       </select>

       <select name="date_year" id="date_year">
             <option selected><?php echo date("Y"); ?></option>
             <option><?php echo (date("Y")+1); ?></option>
       </select>

       <br style="clear: both" /><br style="clear: both" />


	   <div id="calendars">

		<!-- this month -->
		<div class="calendar">

			<div class="cal_heading"><?php echo date("F Y"); ?></div>

			<div class="cal_days">
				<div class="cal_entry cal_entry_head cal_entry_mon">M</div>
				<div class="cal_entry cal_entry_head">T</div>
				<div class="cal_entry cal_entry_head">W</div>
				<div class="cal_entry cal_entry_head">Th</div>
				<div class="cal_entry cal_entry_head">F</div>
				<div class="cal_entry cal_entry_head">Sa</div>
				<div class="cal_entry cal_entry_head">S</div>
			</div>

			<br />

			<div class="cal_main">
			<?php
				$first_day = date("w", strtotime(date("y-m") ."-01"));
				if ($first_day == "0") $first_day = "7";
				if ($first_day != "1") echo "<div class=\"cal_entry cal_entry_mon\">&nbsp;</div>";
				for ($i=2;$i<$first_day;$i++) echo "<div class=\"cal_entry\">&nbsp;</div>";
				$current_day = $first_day;
				for ($i=1;$i<32;$i++) {
					if (   checkdate(date("m"),$i,date("y"))   ) {
						echo "<span class=\"cal_entry";
						if ($current_day == "1") echo " cal_entry_mon";
						echo "\" id=\"d". date("y-m-") . sprintf("%02d",$i) . "\">" . $i . "</span>";
						if ($current_day == "7") {
							$current_day = "1";
							echo "<br />";
						} else $current_day = $current_day + 1;
					}
				}
			?>
			</div>
		</div>



		<!-- next month -->
		<div class="calendar">
			<div class="cal_heading">
			<?php
				$next_month = mktime(0,0,0,date("m")+1,1,date("Y"));
				echo date("F Y",$next_month);
			?>
			</div>

			<div class="cal_days">
				<div class="cal_entry cal_entry_head cal_entry_mon">M</div>
				<div class="cal_entry cal_entry_head">T</div>
				<div class="cal_entry cal_entry_head">W</div>
				<div class="cal_entry cal_entry_head">Th</div>
				<div class="cal_entry cal_entry_head">F</div>
				<div class="cal_entry cal_entry_head">Sa</div>
				<div class="cal_entry cal_entry_head">S</div>
			</div>

			<br />

			<div class="cal_main">
			<?php
				$first_day = date("w", $next_month );
				if ($first_day == "0") $first_day = "7";
				if ($first_day != "1") echo "<div class=\"cal_entry cal_entry_mon\">&nbsp;</div>";
				for ($i=2;$i<$first_day;$i++) echo "<div class=\"cal_entry\">&nbsp;</div>";
				$current_day = $first_day;
				for ($i=1;$i<32;$i++) {
					if (   checkdate(date("m",$next_month),$i,date("y",$next_month))   ) {
						echo "<span class=\"cal_entry";
						if ($current_day == "1") echo " cal_entry_mon";
						echo "\" id=\"d". date("y-m-",$next_month) . sprintf("%02d",$i) . "\">" . $i . "</span>";
						if ($current_day == "7") {
							echo "<br />";
							$current_day = "1";
						} else $current_day = $current_day + 1;
					}
				}
			?>
			</div>
		</div>

	</div> <!-- end calendars -->

	
</td>
   </tr>

   <tr>
     <td class="RightSide">Start Time</td>
     <td class="LeftSide">
       <select name="time_hour">
             <option>00</option>
             <option>01</option>
             <option>02</option>
             <option>03</option>
             <option>04</option>
             <option>05</option>
             <option>06</option>
             <option>07</option>
             <option>08</option>
             <option>09</option>
             <option>10</option>
             <option>11</option>
             <option selected>12</option>
             <option>13</option>
             <option>14</option>
             <option>15</option>
             <option>16</option>
             <option>17</option>
             <option>18</option>
             <option>19</option>
             <option>20</option>
             <option>21</option>
             <option>22</option>
             <option>23</option>
       </select>

       <select name="time_minute">
             <option selected>00</option>
             <option>15</option>
             <option>30</option>
             <option>45</option>
       </select>  (in 24hr format)</td>
   </tr>

   <tr>
     <td class="RightSide">End Time (optional)</td>
     <td class="LeftSide">
       <select name="endtime_hour">
             <option value="blank" selected>&nbsp;</option>
             <option>00</option>
             <option>01</option>
             <option>02</option>
             <option>03</option>
             <option>04</option>
             <option>05</option>
             <option>06</option>
             <option>07</option>
             <option>08</option>
             <option>09</option>
             <option>10</option>
             <option>11</option>
             <option>12</option>
             <option>13</option>
             <option>14</option>
             <option>15</option>
             <option>16</option>
             <option>17</option>
             <option>18</option>
             <option>19</option>
             <option>20</option>
             <option>21</option>
             <option>22</option>
             <option>23</option>
       </select>

       <select name="endtime_minute">
             <option value="blank" selected>&nbsp;</option>
             <option>00</option>
             <option>15</option>
             <option>30</option>
             <option>45</option>
       </select></td>
   </tr>


   <tr>
     <td class="RightSide">Location</td>
     <td class="LeftSide">
         <select name="location">
             <option selected>Whichever space is free</option>
             <option>Main space</option>
             <option>Office space</option>
             <option value="OTHER">other, please specify:</option>
         </select>
         <input name="location_other" type="text" size="38" /></td>
   </tr>

   <tr> 
     <td class="RightSide">Details</td>
     <td class="LeftSide"><textarea name="details" rows="6" cols="60"></textarea></td>
   </tr>

   <tr>
     <td class="RightSide">Public Contact [<a href="hlp_contact.php">?</a>]</td>
     <td class="LeftSide"><input name="contact" type="text" size="75" /></td>
   </tr>

   <tr>
     <td class="RightSide">Internal Contact [<a href="hlp_contact.php">?</a>]</td>
     <td class="LeftSide"><input name="intcontact" type="text" size="75" /></td>
   </tr>

   <tr>
     <td class="RightSide">Contact Keyholders</td>
     <td class="LeftSide"><input name="keys" type="checkbox" value="keys" checked="checked" /> Check box to request a keyholder. Your event is not confirmed until a keyholder is available.<br />You might want to put an email address in one of the contact fields so the keyholder can contact you.</td>
   </tr>

   <tr>
     <td class="RightSide">
       <?php
         $num_given = rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9);
         echo "Copy $num_given to box (antispam)";
       ?>
     </td>
     <td class="LeftSide"><input name="num_user" type="text" size="75" /><input type="hidden" name="num_given" value="<?php echo $num_given; ?>" /></td>
   </tr>

   <tr>
     <td style="text-align:center;height:3em;" colspan="2">
         <input type="submit" name="Submit" value="Add Event" />
         &nbsp;
         <input name="reset" type="reset" id="reset" value="Reset Form" />
     </td>
   </tr>

</table>
</form>

Your event will be added straight to the calendar, but will be marked 'unconfirmed' until a keyholder has signed up to say they can open up the room.<br />
<br />

<div class="Ftr">
<a href="index.php">Back To Calendar</a><br />
</div>

</div>
</body>
</html>
